package cn.tarena.ht.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.tarena.ht.pojo.Role;

public interface RoleMapper {
	
	@Select(value="select * from role_P")
	public List<Role> findRoleList();

	public void addRole(Role role);
	
	@Select(value="select * from role_p where role_id=#{roleId}")
	public Role findRoleById(String roleId);

	public void updateRole(Role role);
	
	@Insert(value="insert into role_module_p values(#{moduleId},#{roleId})")
	public void saveRoleModule(@Param("moduleId")String moduleId, @Param("roleId")String roleId);
	
	@Select(value="select module_id from role_module_p where role_id=#{roleId}")
	public List<String> findModule_roleById(String roleId);
	
	@Delete(value="delete from role_module_p where role_id=#{roleId}")
	public void deleteRole_moduleById(String roleId);
	
	public void deleteRole(String[] roleIds);

	public void deleteRole_userById(String[] roleIds);

}
